<include file="public:header" />
<link rel="stylesheet" type="text/css" href="__STATIC__/js/calendar/calendar-blue.css"/>
<script type="text/javascript" src="__STATIC__/js/calendar/calendar.js"></script>
<form id="info_form" action="{:u('company/edit')}" method="post" enctype="multipart/form-data">
<div class="pad_lr_10">
	<div class="col_tab">
		<ul class="J_tabs tab_but cu_li">
			<li class="current">基本信息</li>
			<li>SEO设置</li>
		</ul>
		<div class="J_panes">
		<div class="content_list pad_10">
		<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
			<tr>
				<th width="80">所属分类 :</th>
				<td><select class="J_cate_select mr10" data-pid="0" data-uri="{:U('items_cate/ajax_getchilds', array('type'=>0))}" data-selected="{$selected_ids}"></select>
				<input type="hidden" name="cate_id" id="J_cate_id" value="{$info.cate_id}" /></td>
			</tr>
			<tr>
				<th>商品名称 :</th>
				<td><input type="text" name="title" id="J_title" class="input-text" size="40" value="{$info.title}"></td>
				<th>商品标签 :</th>
				<td><input type="text" name="tags" id="J_tags" class="input-text" size="30" value="{$info.tags}">
			</tr>
			<tr>
				<th width="80">商品价格 :</th>
				<td width="30%"><input type="text" name="price" size="10" class="input-text" value="{$info.price}"> 元</td>
			</tr>

			<tr>
				<th>在售状态 :</th>
				<td>
					<select name="status" id="status">
						<option value="underway" <if condition="$info['status'] eq 'underway'">selected="selected"</if>>上架/出售中</option>
						<option value="sellout" <if condition="$info['status'] eq 'sellout'">selected="selected"</if>>卖光/下架</option>
						<option value="fail" <if condition="$info['status'] eq 'fail'">selected="selected"</if>>未审核通过</option>
					</select>
				</td>
			</tr>
			<tr>
				<th width="10%">是否显示 :</th>
				<td>
					<select name="isshow" id="isq">
						<option value="0" <if condition="$info['isshow'] eq 0">selected="selected"</if>>否</option>
						<option value="1" <if condition="$info['isshow'] eq 1">selected="selected"</if>>是</option>
					</select>
				</td>

			</tr>
			<tr>
				<th>商品图片 :</th>
				<td>
					<input type="text" name="pic_url" id="J_logo_img" class="input-text fl mr10" size="50" value="{$info.pic_url}">
					<div id="J_logo_upload_img" class="upload_btn">
						<span>{:L('upload')}</span>
					</div>
					<br>
					<br>
					<span class="gray ml10">建议宽:250  高:70  </span>
					<br>
					<br>
					<img src="{$info.pic_url}" height="100" id="show_logo_J_img" /><span class="attachment_icon J_attachment_icon" file-type="image" ></span>
				</td>
				<!--<td><notempty name="info['pic_url']"><img src="{:$info['pic_url']}" width="250"  /><br /></notempty></td>
				<th></th>
				<td><notempty name="info['pic_urls']"><img src="{:$info['pic_urls']}" width="250"  /><br /></notempty></td>-->
			</tr>
			<tr>
				<th>商品简介 :</th>
				<td colspan="6"><textarea name="intro" cols="60" rows="3">{$info.intro}</textarea></td>
			</tr>
		</table>
		
		
		<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
			<tr>
                <th width="10%">详细内容 :</th>
				<td><textarea name="content" id="info" style="width:100%;height:400px;visibility:hidden;resize:none;">{$info.content}</textarea></td>
			</tr>
		</table>
		
		

		
		
		<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
			<tr style="display:none">
				<th>推广链接 :</th>
				<td>
                			<input type="text" name="click_url" id="J_click_url" class="input-text" size="100" value="{$info.click_url}">
					<input type="button" value="{:L('auto_get')}" id="J_getclick_url" name="click_url_btn" class="btn">
				</td>
			</tr>
			<tr>
            			<th>发布人 :</th>
				<td>{$info.uname}</td>
			</tr>
		</table>
		</div>


 
		<div class="content_list pad_10 hidden">
		<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
			<tr>
				<th width="120">{:L('seo_title')} :</th>
 				<td><input type="text" name="seo_title" class="input-text" size="60" value="{$info.seo_title}"></td>
			</tr>
			<tr>
				<th>{:L('seo_keys')} :</th>
				<td><input type="text" name="seo_keys" class="input-text" size="60" value="{$info.seo_keys}"></td>
			</tr>
			<tr>
				<th>{:L('seo_desc')} :</th>
				<td><textarea name="seo_desc" cols="80" rows="8">{$info.seo_desc}</textarea></td>
			</tr>
		</table>
		</div>
        
        </div>
		<div class="mt10"><input type="submit" value="{:L('submit')}" id="dosubmit" name="dosubmit" class="smt  mr10" style="margin:0 0 10px 100px;"></div>
	</div>
</div>
<input type="hidden" name="menuid"  value="{$menuid}"/>
<input type="hidden" name="id" value="{$info.id}" />
<input type="hidden" name="isq"  value="0"/>
</form>
<include file="public:footer" />
<script src="__STATIC__/js/kindeditor/kindeditor.js"></script>
<script src="__STATIC__/js/fileuploader.js"></script>
<script type="text/javascript">
$(function() {
	KindEditor.create('#info', {
		uploadJson : '{:U("attachment/editer_upload")}',
		fileManagerJson : '{:U("attachment/editer_manager")}',
		allowFileManager : true
	});
    var upload = new qq.FileUploaderBasic({
        allowedExtensions: ['jpg','gif','png'],
        button: document.getElementById('J_logo_upload_img'),
        params: {'type':'company'},
        multiple: false,
        action: "{:U('setting/ajax_upload')}",
        inputName: 'img',
        forceMultipart: true, //用$_FILES
        messages: {
            typeError: lang.upload_type_error,
            sizeError: lang.upload_size_error,
            minSizeError: lang.upload_minsize_error,
            emptyError: lang.upload_empty_error,
            noFilesError: lang.upload_nofile_error,
            onLeave: lang.upload_onLeave
        },
        showMessage: function(message){
            $.yhxia.tip({content:message, icon:'error'});
        },
        onSubmit: function(id, fileName){
            $('#J_logo_upload_img').addClass('btn_disabled').find('span').text(lang.uploading);
        },
        onComplete: function(id, fileName, result){
            $('#J_logo_upload_img').removeClass('btn_disabled').find('span').text(lang.upload);
            if(result.status == '1'){
                $('#show_logo_J_img').attr('src',result.data);
                $('#J_logo_img').val(result.data);
            }else{
                $.yhxia.tip({content:result.msg, icon:'error'});
            }
        }
    });
});

$('.J_cate_select').cate_select('请选择');
$(function() {	
	$('ul.J_tabs').tabs('div.J_panes > div');
	//自动获取标签
	$('#J_gettags').live('click', function() {
		var title = $.trim($('#J_title').val());
		if(title == ''){
			$.yhxia.tip({content:lang.title_empty, icon:'alert'});
			return false;
		}
		$.getJSON('{:U("items/ajax_gettags")}', {title:title}, function(result){
			if(result.status == 1){
				$('#J_tags').val(result.data);
			}else{
				$.yhxia.tip({content:result.msg});
			}
		});
	});

	$('#J_getclick_url').live('click', function() {
		var iid = $.trim($('#J_num_iid').val());
		if(iid == ''){
			$.yhxia.tip({content:lang.iid_empty, icon:'alert'});
			return false;
		}
		$.getJSON('{:U("items/ajax_getclick_url")}', {iid:iid}, function(result){
			if(result.status == 1){
				//$('#J_click_url').val(result.data);
			}else{
				$.yhxia.tip({content:result.msg});
			}
		});
	});

	$.formValidator.initConfig({formid:"info_form",autotip:true});
	$("#J_title").formValidator({onshow:'请填写商品名称',onfocus:'请填写商品名称'}).inputValidator({min:1,onerror:'请填写商品名称'}).defaultPassed();
});
function get_child_cates(obj,to_id)
{
	var parent_id = $(obj).val();
	if( parent_id ){
		$.get('?m=items&a=get_child_cates&g=admin&parent_id='+parent_id,function(data){
				var obj = eval("("+data+")");
				$('#'+to_id).html( obj.content );
	    });
    }
}
 
 
</script>
<script language="javascript" type="text/javascript">
    /**Calendar.setup({
        inputField     :    "coupon_start_time",
        ifFormat       :    "%Y-%m-%d %H:%M",
        showsTime      :    'true',
        timeFormat     :    "24"
    });**/
</script>
<script language="javascript" type="text/javascript">
    /**Calendar.setup({
        inputField     :    "coupon_end_time",
        ifFormat       :    "%Y-%m-%d %H:%M",
        showsTime      :    'true',
        timeFormat     :    "24"
    });**/
</script>
</body>
</html>